1# gridfinity-rebuilt-bins
2
3Generates stock bins, with a great number of variations.
4
5
6
7## Script Parameters
8
9Parameter | Range | Description
10--- | ----- | ---
11gridx | { n>0 \| n∈R } | number of bases along the x-axis
12gridy | { n>0 \| n∈R } | number of bases along the y-axis
13gridz | { n>0 \| n∈R } | bin height. See bin height information and "gridz_define" below.
14length | { n>0 \| n∈R } | length of one unit of the base. <br> default: 42 (The Answer to the Ultimate Question of Life, <br>the Universe, and Everything.)
15divx | { n>0 \| n∈Z } | number of compartments along X
16divy | { n>0 \| n∈Z } | number of compartments along Y
17scoop | n>0 \| n∈R | controls the fillet on the bottom of the compartment for easy <br> item removal. 0 is disabled, 1 is full, any other real number will <br> scale from full.
18enable_zsnap | boolean | automatically snap the bin size to the nearest 7mm increment. <br> default: true
19style_lip | {0, 1, 2} | if you are not stacking the bin, you can disable the top lip <br> to save space. <br> • (0) Regular lip <br> • (1) Subtract lip to save space <br> • (2) Disable lip while retaining height
20gridz_define | { n>0 \| n∈R } | determine what the variable "gridz" applies to based on <br> your use case. default: 0. <br> • (0) gridz is the height in # of 7mm increments (Zack) <br> • (1) gridz is the internal height in millimeters <br> • (2) gridz is the overall external height of the bin in millimeters
21height_internal | { n>0 \| n∈R } | height of the internal block. <br> Can be lower than bin height to save filament on custom bins. <br> default of 0 means use the calculated height.
22style_tab | { 0, 1, 2, 3, 4, 5 } | how the tabs for labels are generated. <br> • (0) Full tabs across the entire compartment <br> • (1) automatic tabs <br> - left aligned tabs on the left edge<br> - right aligned tabs on right edge<br> - center tabs otherwise <br> • (2) left aligned tabs <br> • (3) center aligned tabs <br> • (4) right aligned tabs <br> • (5) no tabs
23style_hole | { 0, 1, 2, 3 } | the style of holes in the bases <br> • (0) No holes <br> • (1) Magnet holes only <br> • (2) Magnet and screw holes - no printable slit <br> • (3) Magnet and screw holes - with printable slit
24div_base_x | { n>=0 \| n∈Z } | number of divisions per 1 unit of base along the X axis. <br>(default 1, only use integers. <br>0 means automatically guess the division)
25div_base_y | { n>=0 \| n∈Z } | number of divisions per 1 unit of base along the Y axis. <br>(default 1, only use integers. <br>0 means automatically guess the division)
26
27<br>
28
29## Modules
30
31---
32
33### gridfinityInit
34
35Initializes the top part of the bin (walls and solid section). All bins have to use this module, and have the compartments cut out from it.
36
37** `gridfinityInit (gridx, gridy, height, height_internal, length)` **
38
39Parameter | Range | Description
40--- | ----- | ---
41gridx | { n>0 \| n∈R } | number of bases along the x-axis
42gridy | { n>0 \| n∈R } | number of bases along the y-axis
43height | { n>0 \| n∈R } | height of the bin, in millimeters (but not exactly). <br> See the `height()` function for more info.
44height_internal | { n>0 \| n∈R } | height of the internal block. <br> Can be lower than bin height to save filament on custom bins. <br> default of 0 means use the calculated height.
45length | { n>0 \| n∈R } | length of one unit of the base. <br> default: 42 (The Answer to the Ultimate Question of Life, <br>the Universe, and Everything.)
46style_lip | {0, 1, 2} | if you are not stacking the bin, you can disable the top lip <br> to save space. <br> • (0) Regular lip <br> • (1) Subtract lip to save space <br> • (2) Disable lip while retaining height
47
48```
49// Example: generate a 3x3x6 bin with a 42mm unit size
50gridfinityInit(3, 3, height(6), 0, 42) {
51 cutEqual(n_divx = 3, n_divy = 3, style_tab = 0, scoop_weight = 1);
52}
53```
54
55---
56
57### height
58
59Calculates the proper height for bins.
60
61** `height (gridz, gridz_define, style_lip, enable_zsnap)` **
62
63Parameter | Range | Description
64--- | ----- | ---
65gridz | { n>0 \| n∈R } | bin height. See bin height information and "gridz_define" below.
66gridz_define | { n>0 \| n∈R } | determine what the variable "gridz" applies to based on <br> your use case. default: 0. <br> • (0) gridz is the height in # of 7mm increments (Zack) <br> • (1) gridz is the internal height in millimeters <br> • (2) gridz is the overall external height of the bin in millimeters
67style_lip | {0, 1, 2} | if you are not stacking the bin, you can disable the top lip <br> to save space. <br> • (0) Regular lip <br> • (1) Subtract lip to save space <br> • (2) Disable lip while retaining height
68enable_zsnap | boolean | automatically snap the bin size to the nearest 7mm increment. <br> default: true
69
70```
71// Example: height for a 6 unit high bin
72height(6);
73
74// Example: height for a bin that can fit (at maximum) a 30mm high object inside
75height(30, 1, 0, false);
76```
77
78---
79
80### gridfinityBase
81
82Generates the bases for bins. Has various different hole styles, and can be subdivided.
83
84** `gridfinityBase (gridx, gridy, length, div_base_x, div_base_y, style_hole)` **
85
86Parameter | Range | Description
87--- | ----- | ---
88gridx | { n>0 \| n∈R } | number of bases along the x-axis
89gridy | { n>0 \| n∈R } | number of bases along the y-axis
90length | { n>0 \| n∈R } | length of one unit of the base. default: 42
91div_base_x | { n>=0 \| n∈Z } | number of divisions per 1 unit of base along the X axis. <br>(default 1, only use integers. 0 means automatically guess the division)
92div_base_y | { n>=0 \| n∈Z } | number of divisions per 1 unit of base along the Y axis. <br>(default 1, only use integers. 0 means automatically guess the division)
93style_hole | { 0, 1, 2, 3 } | the style of holes in the bases <br> • (0) No holes <br> • (1) Magnet holes only <br> • (2) Magnet and screw holes - no printable slit <br> • (3) Magnet and screw holes - with printable slit
94
95```
96// Example: generate a 3x3 base with a 42mm unit size and clean magnet holes
97gridfinityBase(3, 3, 42, 0, 0, 1);
98```
99
100---
101
102### cutEqual
103
104Generates the "traditional" bin cutters. It is a utility function that creates evenly distributed compartments.
105
106** `cutEqual (n_divx, n_divy, style_tab, scoop_weight)` **
107
108Parameter | Range | Description
109--- | ----- | ---
110n_divx | { n>0 \| n∈Z } | number of compartments along X
111n_divy | { n>0 \| n∈Z } | number of compartments along Y
112style_tab | { 0, 1, 2, 3, 4, 5 } | how the tabs for labels are generated. <br> • (0) Full tabs across the entire compartment <br> • (1) automatic tabs <br> - left aligned tabs on the left edge<br> - right aligned tabs on right edge<br> - center tabs otherwise <br> • (2) left aligned tabs <br> • (3) center aligned tabs <br> • (4) right aligned tabs <br> • (5) no tabs
113scoop | n>0 \| n∈R | controls the fillet on the bottom of the compartment for easy <br> item removal. 0 is disabled, 1 is full, any other real number will <br> scale from full.
114
115```
116// Example: this generates 9 compartments in a 3x3 grid, and all compartments have a full tab and a scoop
117gridfinityInit(3, 3, height(6), 0, 42) {
118 cutEqual(n_divx = 3, n_divy = 3, style_tab = 0, scoop_weight = 1);
119}
120```
121
122---
123
124### cut
125
126Cuts a single compartment into the bin at the provided location with the provided attributes. The coordinate system for compartments originates (0,0) at the bottom left corner of the bin, where 1 unit is the length of 1 base. Positive X and positive Y are in the same direction as the global coordinate system.
127
128** `cut (x, y, w, h, t, s)` **
129
130Parameter | Range | Description
131--- | ----- | ---
132x | { n>=0 \| n∈R } | X coordinate of the compartment <br>(position of left edge of compartment)
133y | { n>=0 \| n∈R } | Y coordinate of the compartment <br>(position of bottom edge of compartment)
134w | { n>0 \| n∈R } | Width of the compartment, in base units <br>(1 unit = 1 `length`)
135h | { n>0 \| n∈R } | Height of the compartment, in base units <br>(1 unit = 1 `length`)
136t | { 0, 1, 2, 3, 4, 5 } | how the tabs for labels are generated for this compartment. <br> • (0) Full tabs across the entire compartment <br> • (1) automatic tabs <br> - left aligned tabs on the left edge<br> - right aligned tabs on right edge<br> - center tabs otherwise <br> • (2) left aligned tabs <br> • (3) center aligned tabs <br> • (4) right aligned tabs <br> • (5) no tabs
137s | n>0 \| n∈R | controls the fillet on the bottom of the compartment for easy <br> item removal. 0 is disabled, 1 is full, any other real number will <br> scale from full, only for this specific compartment
138
139```
140// Example:
141// this cuts two compartments that are both 1 wide and 2 high.
142// One is on the bottom left, and the other is at the top right.
143gridfinityInit(3, 3, height(6), 0, 42) {
144 cut(0, 0, 1, 2, 0, 1);
145 cut(2, 1, 1, 2, 0, 1);
146}
147```
148
149---
150
151### cut_move
152
153Moves all of its children from the global origin to the center of the area that a compartment would normally fill, and uses them to cut from the bin. This allows you to easily make custom cutouts in the bin.
154
155** `cut_move (x, y, w, h)` **
156
157Parameter | Range | Description
158--- | ----- | ---
159x | { n>=0 \| n∈R } | X coordinate of the area (position of left edge)
160y | { n>=0 \| n∈R } | Y coordinate of the area (position of bottom edge)
161w | { n>0 \| n∈R } | Width of the area, in base units (1 unit = 1 `length`)
162h | { n>0 \| n∈R } | Height of the area, in base units (1 unit = 1 `length`)
163
164```
165// Example:
166// cuts a cylindrical hole of radius 5
167// hole center is located 1/2 units from the right edge of the bin, and 1 unit from the top
168gridfinityInit(3, 3, height(6), 0, 42) {
169 cut_move(x=2, y=1, w=1, h=2) {
170 cylinder(r=5, h=100, center=true);
171 }
172}
173```